<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$hosocanbos = $this->get('hosocanbos');
$pagination = $this->get('pagination');
$session = JFactory::getSession();
$phongs = $this->get('phong');
$donvis = $this->get('donvi');
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Tìm kiếm cán bộ</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Tra cứu thông tin hồ sơ cán bộ của viện khoa học và công nghệ Việt Nam</h3>
    <div class="search-form">
        <div class="wide form">
            <form id="commentform" class="commentform" class="form-validate" method="post" action="index.php?option=com_vast&view=timkiemnhanvien">
    
                <div class="row">
                    <label style="text-align: left;">Họ tên</label>		
                    <input size="60" maxlength="128" name="hosocanboHoten" id="hosocanboHoten" type="text" value="<?php if ($session->get('timkiemnhanvien.hoten') !== NULL) echo $session->get('timkiemnhanvien.hoten'); ?>"/>	
                </div>
    
                <div class="row">
                    <label style="text-align: left;">Giới tính</label>                
                    <select style="width: 25%;" name="hosocanboGioitinh" id="hosocanboGioitinh">
                        <?php if ($session->get('timkiemnhanvien.gioitinh') == 2): ?>
                        <option value="2" selected="selected">-Tất cả-</option>
                        <?php else: ?>
                        <option value="2">-Tất cả-</option>
                        <?php endif; ?>
                        <?php if ($session->get('timkiemnhanvien.gioitinh') == 1): ?>
                        <option value="1" selected="selected">Nam</option>
                        <?php else: ?>
                        <option value="1">Nam</option>
                        <?php endif; ?>
                        <?php if ($session->get('timkiemnhanvien.gioitinh') == 0): ?>
                        <option value="0" selected="selected">Nữ</option>
                        <?php else: ?>
                        <option value="0">Nữ</option>
                        <?php endif; ?>
                    </select>    
                </div>
    
                <div class="row">
                    <label style="text-align: left;">Lọc theo phòng</label>                
                    <select style="width: 25%;" name="hosocanboPhong" id="hosocanboPhong">
                        <?php if ($session->get('timkiemnhanvien.phong') == -1): ?>
                        <option value="-1" selected="selected">-Tất cả các phòng-</option>
                        <?php else: ?>
                        <option value="-1">-Tất cả các phòng-</option>
                        <?php endif; ?>
                        <?php foreach ($phongs as $phong): ?>
                        <?php if ($session->get('timkiemnhanvien.phong') == $phong->id): ?>
                            <option value="<?php echo $phong->id; ?>" selected="selected"><?php echo $phong->ten; ?></option>
                        <?php else: ?>
                            <option value="<?php echo $phong->id; ?>"><?php echo $phong->ten; ?></option>
                        <?php endif; ?>
                        <?php endforeach; ?>    
                    </select>
                </div>

                <div class="row">
                    <label style="text-align: left;">Lọc theo đơn vị</label>                
                    <select style="width: 25%;" name="hosocanboDonvi" id="hosocanboDonvi">
                        <?php if ($session->get('timkiemnhanvien.donvi') == -1): ?>
                        <option value="-1" selected="selected">-Tất cả các đơn vị-</option>
                        <?php else: ?>
                        <option value="-1">-Tất cả các đơn vị-</option>
                        <?php endif; ?>
                        <?php foreach ($donvis as $donvi): ?>
                        <?php if ($session->get('timkiemnhanvien.donvi') == $donvi->id): ?>
                            <option value="<?php echo $donvi->id; ?>" selected="selected"><?php echo $donvi->ten; ?></option>
                        <?php else: ?>
                            <option value="<?php echo $donvi->id; ?>"><?php echo $donvi->ten; ?></option>
                        <?php endif; ?>
                        <?php endforeach; ?>    
                    </select>
                </div>

                <div class="row buttons">
                    <input type="hidden" name="view" value="timkiemnhanvien" />
                    <input id="submit" value="Tìm kiếm" type="submit"/>	
                    <?php echo JHtml::_('form.token'); ?>
                </div>
    
            </form>
        </div>
    </div>
    
    <div>
        <table id="rounded-corner">
            <thead>
                <tr>
                    <th scope="col" class="rounded-company"><a href="#hoten">Họ tên</a></th>
                    <th scope="col" class="rounded-q1"><a href="#ngaysinh">Ngày sinh</a></th>
                    <th scope="col" class="rounded-q2"><a href="#ngaysinh">Quê quán</a></th>
                    <th scope="col" class="rounded-q3"><a href="#ngaysinh">Điện thoại</a></th>
                    <th scope="col" class="rounded-q4"><a href="#ngaysinh">Thư điện tử</a></th>
                </tr>    
    <!--            <tr>
                    <th scope="col" class="rounded-q1" width="30%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                </tr>-->
            </thead>
            <tfoot>
                <tr>
                    <td colspan="4" class="rounded-foot-left">
                        <em>
                        </em>
                    </td>
                    <td class="rounded-foot-right" style="font-size: smaller;">
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php if (count($hosocanbos) > 0): ?>
                <?php foreach ($hosocanbos as $hoso) { ?>
                    <tr>
                        <td><a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $hoso->id); ?>"><?= $hoso->hoten ?></a></td>
                        <td><?= $hoso->ngaysinh ?></td>
                        <td><?= $hoso->nguyenquan ?></td>
                        <td><?= $hoso->dienthoai ?></td>
                        <td><?= $hoso->thudientu ?></td>
                    </tr>
                <?php } ?>
                <?php endif; ?>
            </tbody>
        </table>
        <div id="tnt_pagination" style="margin-top: 5px;">
        <?php
            echo $pagination->getPagesLinks();
        ?>
        </div>    
    </div>
</div>